"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
    return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (g && (g = 0, op[0] && (_ = 0)), _) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
    if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
        if (ar || !(i in from)) {
            if (!ar) ar = Array.prototype.slice.call(from, 0, i);
            ar[i] = from[i];
        }
    }
    return to.concat(ar || Array.prototype.slice.call(from));
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var vue_router_1 = require("vue-router");
var icons_vue_1 = require("@ant-design/icons-vue");
var pictureController_ts_1 = require("@/api/pictureController.ts");
var ant_design_vue_1 = require("ant-design-vue");
var ShareModal_vue_1 = __importDefault(require("@/components/ShareModal.vue"));
var vue_1 = require("vue");
var props = withDefaults(defineProps(), {
    dataList: function () { return []; },
    loading: false,
    showOp: false,
    canEdit: false,
    canDelete: false,
});
var router = (0, vue_router_1.useRouter)();
// 跳转至图片详情页
var doClickPicture = function (picture) {
    router.push({
        path: "/picture/".concat(picture.id),
    });
};
// 搜索
var doSearch = function (picture, e) {
    // 阻止冒泡
    e.stopPropagation();
    // 打开新的页面
    window.open("/search_picture?pictureId=".concat(picture.id));
};
// 编辑
var doEdit = function (picture, e) {
    // 阻止冒泡
    e.stopPropagation();
    // 跳转时一定要携带 spaceId
    router.push({
        path: '/add_picture',
        query: {
            id: picture.id,
            spaceId: picture.spaceId,
        },
    });
};
// 删除数据
var doDelete = function (picture, e) { return __awaiter(void 0, void 0, void 0, function () {
    var id, res;
    var _a;
    return __generator(this, function (_b) {
        switch (_b.label) {
            case 0:
                // 阻止冒泡
                e.stopPropagation();
                id = picture.id;
                if (!id) {
                    return [2 /*return*/];
                }
                return [4 /*yield*/, (0, pictureController_ts_1.deletePictureUsingPost)({ id: id })];
            case 1:
                res = _b.sent();
                if (res.data.code === 0) {
                    ant_design_vue_1.message.success('删除成功');
                    (_a = props.onReload) === null || _a === void 0 ? void 0 : _a.call(props);
                }
                else {
                    ant_design_vue_1.message.error('删除失败');
                }
                return [2 /*return*/];
        }
    });
}); };
// ----- 分享操作 ----
var shareModalRef = (0, vue_1.ref)();
// 分享链接
var shareLink = (0, vue_1.ref)();
// 分享
var doShare = function (picture, e) {
    // 阻止冒泡
    e.stopPropagation();
    shareLink.value = "".concat(window.location.protocol, "//").concat(window.location.host, "/picture/").concat(picture.id);
    if (shareModalRef.value) {
        shareModalRef.value.openModal();
    }
}; /* PartiallyEnd: #3632/scriptSetup.vue */
var __VLS_withDefaultsArg = (function (t) { return t; })({
    dataList: function () { return []; },
    loading: false,
    showOp: false,
    canEdit: false,
    canDelete: false,
});
function __VLS_template() {
    var _a, _b;
    var __VLS_ctx = {};
    var __VLS_components;
    var __VLS_directives;
    // CSS variable injection 
    // CSS variable injection end 
    __VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)(__assign({ class: ("picture-list") }));
    var __VLS_0 = {}.AList;
    /** @type { [typeof __VLS_components.AList, typeof __VLS_components.aList, typeof __VLS_components.AList, typeof __VLS_components.aList, ] } */ ;
    // @ts-ignore
    var __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({
        grid: (({ gutter: 16, xs: 1, sm: 2, md: 3, lg: 4, xl: 5, xxl: 6 })),
        dataSource: ((__VLS_ctx.dataList)),
        loading: ((__VLS_ctx.loading)),
    }));
    var __VLS_2 = __VLS_1.apply(void 0, __spreadArray([{
            grid: (({ gutter: 16, xs: 1, sm: 2, md: 3, lg: 4, xl: 5, xxl: 6 })),
            dataSource: ((__VLS_ctx.dataList)),
            loading: ((__VLS_ctx.loading)),
        }], __VLS_functionalComponentArgsRest(__VLS_1), false));
    __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
    {
        var __VLS_thisSlot = __VLS_5.slots.renderItem;
        var picture_1 = __VLS_getSlotParam(__VLS_thisSlot).item;
        var __VLS_6 = {}.AListItem;
        /** @type { [typeof __VLS_components.AListItem, typeof __VLS_components.aListItem, typeof __VLS_components.AListItem, typeof __VLS_components.aListItem, ] } */ ;
        // @ts-ignore
        var __VLS_7 = __VLS_asFunctionalComponent(__VLS_6, new __VLS_6(__assign({ style: ({}) })));
        var __VLS_8 = __VLS_7.apply(void 0, __spreadArray([__assign({ style: ({}) })], __VLS_functionalComponentArgsRest(__VLS_7), false));
        var __VLS_12 = {}.ACard;
        /** @type { [typeof __VLS_components.ACard, typeof __VLS_components.aCard, typeof __VLS_components.ACard, typeof __VLS_components.aCard, ] } */ ;
        // @ts-ignore
        var __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12(__assign({ 'onClick': {} }, { hoverable: (true) })));
        var __VLS_14 = __VLS_13.apply(void 0, __spreadArray([__assign({ 'onClick': {} }, { hoverable: (true) })], __VLS_functionalComponentArgsRest(__VLS_13), false));
        var __VLS_18 = void 0;
        var __VLS_19 = {
            onClick: function () {
                var _a = [];
                for (var _i = 0; _i < arguments.length; _i++) {
                    _a[_i] = arguments[_i];
                }
                var $event = _a[0];
                __VLS_ctx.doClickPicture(picture_1);
            }
        };
        var __VLS_15 = void 0;
        var __VLS_16 = void 0;
        __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
        {
            var __VLS_thisSlot_1 = __VLS_17.slots.cover;
            __VLS_elementAsFunction(__VLS_intrinsicElements.img)(__assign({ alt: ((picture_1.name)), src: (((_a = picture_1.thumbnailUrl) !== null && _a !== void 0 ? _a : picture_1.url)) }, { style: ({}) }));
        }
        var __VLS_20 = {}.ACardMeta;
        /** @type { [typeof __VLS_components.ACardMeta, typeof __VLS_components.aCardMeta, typeof __VLS_components.ACardMeta, typeof __VLS_components.aCardMeta, ] } */ ;
        // @ts-ignore
        var __VLS_21 = __VLS_asFunctionalComponent(__VLS_20, new __VLS_20({
            title: ((picture_1.name)),
        }));
        var __VLS_22 = __VLS_21.apply(void 0, __spreadArray([{
                title: ((picture_1.name)),
            }], __VLS_functionalComponentArgsRest(__VLS_21), false));
        __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
        {
            var __VLS_thisSlot_2 = __VLS_25.slots.description;
            var __VLS_26 = {}.AFlex;
            /** @type { [typeof __VLS_components.AFlex, typeof __VLS_components.aFlex, typeof __VLS_components.AFlex, typeof __VLS_components.aFlex, ] } */ ;
            // @ts-ignore
            var __VLS_27 = __VLS_asFunctionalComponent(__VLS_26, new __VLS_26({}));
            var __VLS_28 = __VLS_27.apply(void 0, __spreadArray([{}], __VLS_functionalComponentArgsRest(__VLS_27), false));
            var __VLS_32 = {}.ATag;
            /** @type { [typeof __VLS_components.ATag, typeof __VLS_components.aTag, typeof __VLS_components.ATag, typeof __VLS_components.aTag, ] } */ ;
            // @ts-ignore
            var __VLS_33 = __VLS_asFunctionalComponent(__VLS_32, new __VLS_32({
                color: ("green"),
            }));
            var __VLS_34 = __VLS_33.apply(void 0, __spreadArray([{
                    color: ("green"),
                }], __VLS_functionalComponentArgsRest(__VLS_33), false));
            ((_b = picture_1.category) !== null && _b !== void 0 ? _b : '默认');
            __VLS_37.slots.default;
            var __VLS_37;
            for (var _i = 0, _c = __VLS_getVForSourceType((picture_1.tags)); _i < _c.length; _i++) {
                var tag = _c[_i][0];
                var __VLS_38 = {}.ATag;
                /** @type { [typeof __VLS_components.ATag, typeof __VLS_components.aTag, typeof __VLS_components.ATag, typeof __VLS_components.aTag, ] } */ ;
                // @ts-ignore
                var __VLS_39 = __VLS_asFunctionalComponent(__VLS_38, new __VLS_38({
                    key: ((tag)),
                }));
                var __VLS_40 = __VLS_39.apply(void 0, __spreadArray([{
                        key: ((tag)),
                    }], __VLS_functionalComponentArgsRest(__VLS_39), false));
                (tag);
                __VLS_43.slots.default;
                var __VLS_43;
            }
            __VLS_31.slots.default;
            var __VLS_31;
        }
        var __VLS_25;
        if (__VLS_ctx.showOp) {
            __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
            {
                var __VLS_thisSlot_3 = __VLS_17.slots.actions;
                var __VLS_44 = {}.ShareAltOutlined;
                /** @type { [typeof __VLS_components.ShareAltOutlined, ] } */ ;
                // @ts-ignore
                var __VLS_45 = __VLS_asFunctionalComponent(__VLS_44, new __VLS_44(__assign({ 'onClick': {} })));
                var __VLS_46 = __VLS_45.apply(void 0, __spreadArray([__assign({ 'onClick': {} })], __VLS_functionalComponentArgsRest(__VLS_45), false));
                var __VLS_50 = void 0;
                var __VLS_51 = {
                    onClick: (function (e) { return __VLS_ctx.doShare(picture_1, e); })
                };
                var __VLS_47 = void 0;
                var __VLS_48 = void 0;
                var __VLS_49;
                var __VLS_52 = {}.SearchOutlined;
                /** @type { [typeof __VLS_components.SearchOutlined, ] } */ ;
                // @ts-ignore
                var __VLS_53 = __VLS_asFunctionalComponent(__VLS_52, new __VLS_52(__assign({ 'onClick': {} })));
                var __VLS_54 = __VLS_53.apply(void 0, __spreadArray([__assign({ 'onClick': {} })], __VLS_functionalComponentArgsRest(__VLS_53), false));
                var __VLS_58 = void 0;
                var __VLS_59 = {
                    onClick: (function (e) { return __VLS_ctx.doSearch(picture_1, e); })
                };
                var __VLS_55 = void 0;
                var __VLS_56 = void 0;
                var __VLS_57;
                if (__VLS_ctx.canEdit) {
                    var __VLS_60 = {}.EditOutlined;
                    /** @type { [typeof __VLS_components.EditOutlined, ] } */ ;
                    // @ts-ignore
                    var __VLS_61 = __VLS_asFunctionalComponent(__VLS_60, new __VLS_60(__assign({ 'onClick': {} })));
                    var __VLS_62 = __VLS_61.apply(void 0, __spreadArray([__assign({ 'onClick': {} })], __VLS_functionalComponentArgsRest(__VLS_61), false));
                    var __VLS_66 = void 0;
                    var __VLS_67 = {
                        onClick: (function (e) { return __VLS_ctx.doEdit(picture_1, e); })
                    };
                    var __VLS_63 = void 0;
                    var __VLS_64 = void 0;
                    var __VLS_65;
                }
                if (__VLS_ctx.canDelete) {
                    var __VLS_68 = {}.DeleteOutlined;
                    /** @type { [typeof __VLS_components.DeleteOutlined, ] } */ ;
                    // @ts-ignore
                    var __VLS_69 = __VLS_asFunctionalComponent(__VLS_68, new __VLS_68(__assign({ 'onClick': {} })));
                    var __VLS_70 = __VLS_69.apply(void 0, __spreadArray([__assign({ 'onClick': {} })], __VLS_functionalComponentArgsRest(__VLS_69), false));
                    var __VLS_74 = void 0;
                    var __VLS_75 = {
                        onClick: (function (e) { return __VLS_ctx.doDelete(picture_1, e); })
                    };
                    var __VLS_71 = void 0;
                    var __VLS_72 = void 0;
                    var __VLS_73;
                }
            }
        }
        var __VLS_17;
        __VLS_11.slots.default;
        var __VLS_11;
    }
    var __VLS_5;
    // @ts-ignore
    /** @type { [typeof ShareModal, ] } */ ;
    // @ts-ignore
    var __VLS_76 = __VLS_asFunctionalComponent(ShareModal_vue_1.default, new ShareModal_vue_1.default({
        ref: ("shareModalRef"),
        link: ((__VLS_ctx.shareLink)),
    }));
    var __VLS_77 = __VLS_76.apply(void 0, __spreadArray([{
            ref: ("shareModalRef"),
            link: ((__VLS_ctx.shareLink)),
        }], __VLS_functionalComponentArgsRest(__VLS_76), false));
    // @ts-ignore navigation for `const shareModalRef = ref()`
    /** @type { typeof __VLS_ctx.shareModalRef } */ ;
    var __VLS_81 = {};
    var __VLS_80;
    ['picture-list',];
    var __VLS_slots;
    var $slots;
    var __VLS_inheritedAttrs;
    var $attrs;
    var __VLS_refs = {
        'shareModalRef': __VLS_81,
    };
    var $refs;
    var $el;
    return {
        attrs: {},
        slots: __VLS_slots,
        refs: $refs,
        rootEl: $el,
    };
}
;
var __VLS_self = (await Promise.resolve().then(function () { return __importStar(require('vue')); })).defineComponent({
    setup: function () {
        return {
            DeleteOutlined: icons_vue_1.DeleteOutlined,
            EditOutlined: icons_vue_1.EditOutlined,
            SearchOutlined: icons_vue_1.SearchOutlined,
            ShareAltOutlined: icons_vue_1.ShareAltOutlined,
            ShareModal: ShareModal_vue_1.default,
            doClickPicture: doClickPicture,
            doSearch: doSearch,
            doEdit: doEdit,
            doDelete: doDelete,
            shareModalRef: shareModalRef,
            shareLink: shareLink,
            doShare: doShare,
        };
    },
    __typeProps: {},
    props: {},
});
exports.default = (await Promise.resolve().then(function () { return __importStar(require('vue')); })).defineComponent({
    setup: function () {
        return {};
    },
    __typeProps: {},
    props: {},
    __typeRefs: {},
    __typeEl: {},
});
; /* PartiallyEnd: #4569/main.vue */
